﻿@model PagedList.IPagedList<DealKhuyenMaiV2.com.Models.Account>

<div id="ListCompany">
    <table class="list">
        <thead>
            <tr>
                <td class="left">
                    Tên Doanh Nghiệp
                </td>
                <td class="left">
                    Địa Chỉ
                </td>
                <td class="left">
                    Số Điện Thoại
                </td>
                <td class="left">
                    Email
                </td>
                <td class="center">
                    Đang Hoạt Động
                </td>
                <td class="right">
                Thực Hiện
                </td>
            </tr>
        </thead>
        @foreach (var item in Model)
        {
            <tr>
                <td class="left">
                    @Html.DisplayFor(modelItem => item.FullName)
                </td>
                <td class="left">
                    @Html.DisplayFor(modelItem => item.AddressReceive)
                </td>
                <td class="left">
                    @Html.DisplayFor(modelItem => item.PhoneNumber)
                </td>
                <td class="left">
                    @Html.DisplayFor(modelItem => item.Email)
                </td>
                <td class="center">
                    @Html.DisplayFor(modelItem => item.Active)
                </td>
                <td class="right">
                    @Html.ActionLink("Edit", "Edit", new { id = item.IDAccount }) |
                    
                    @Ajax.ActionLink("Delete", "Delete", "CompanyManager", new { page = Model.PageNumber, id = item.IDAccount }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListCompany", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
                </td>
            </tr>
        }
    </table>
    <div>
        Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
        of @Model.PageCount
        @if (Model.HasPreviousPage)
        {
               
            @Ajax.ActionLink("<<", ViewBag.Methol as string, "CompanyManager", new { page = 1, KeyWord = ViewBag.KeyWord as string }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListCompany", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
            @Html.Raw(" ");
            @Html.Raw(" ");
            @Ajax.ActionLink("< Prev", ViewBag.Methol as string, "CompanyManager", new { page = Model.PageNumber - 1, KeyWord = ViewBag.KeyWord as string }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListCompany", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
        }
        else
        {
            @:<<
                @Html.Raw(" ");
            @:< Prev
                                    }
        @if (Model.HasNextPage)
        {
            @Ajax.ActionLink("Next >", ViewBag.Methol as string, "CompanyManager", new { page = Model.PageNumber + 1, KeyWord = ViewBag.KeyWord as string }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListCompany", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
            @Html.Raw(" ");
            @Ajax.ActionLink(">>", ViewBag.Methol as string, "CompanyManager", new { page = Model.PageCount, KeyWord = ViewBag.KeyWord as string }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "ListCompany", InsertionMode = InsertionMode.Replace, LoadingElementId = "loadingImage" })
        }
        else
        {
            @:Next >
                @Html.Raw(" ")
            @:>>
                                    }
    </div>
</div>
